﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Shove.Web.UI;

public partial class UserControls_Bottom : UCBase
{
    public string SiteSnzz = "";    //站点流量统计

    public UserControls_Bottom()
    {
        Name = "底部控件";

        swpas = new ShoveWebPartAttribute[2];

        swpas[0] = new ShoveWebPartAttribute_Int("控件宽度", "1,1020", 966, "控件宽度");
        swpas[1] = new ShoveWebPartAttribute_Int("控件高度", "1,300", 150, "控件高度");        
        
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        InitlayOut();

        LoadScript();
        BindData();
    }

    private void InitlayOut()
    {
        //tabctr.Width = swpAttributes[0];
        //tabctr.Height = swpAttributes[1];                   
    }

    private void BindData()
    {
        DataTable dt = null;

        dt = new DAL.Tables.tbl_Site_HelpType().Open("", "ParentID=0 and Status = 1", "id");

        this.dlHelp.DataSource = dt;
        this.dlHelp.DataBind();
    }

    /// <summary>
    /// 嵌入网络电话代码
    /// </summary>
    private void LoadScript()
    {
        DataTable dt = new DAL.Tables.tbl_Shop().Open("", "[ID]=1", "");

        if (dt != null && dt.Rows.Count > 0)
        {
            SiteSnzz = dt.Rows[0]["SiteCnzz"].ToString();
        }
    }

    protected void dlHelp_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        HtmlInputHidden input = (HtmlInputHidden)e.Item.FindControl("TypeID");
        Label lab = (Label)e.Item.FindControl("labInfo");
        string temp = "";
        int TypeID = Shove._Convert.StrToInt(input.Value, 0);

        if (TypeID > 0)
        {
            temp += "<tr><td height='100' valign ='top'>";

            DataTable dt = null;

            dt = new DAL.Tables.tbl_Site_HelpType().Open("", "ParentID=" + TypeID + " and Status = 1", "");

            for (int j = 0; j < dt.Rows.Count; j++)
            {
                temp += "<a href='Default.aspx?PN=Service&TypeID=" + dt.Rows[j]["id"].ToString() + "' class='like-2'>" + dt.Rows[j]["TypeName"].ToString() + "</a><br />";
            }            

            temp += "</td></tr>";
        }

        lab.Text = temp;
    }

}
